<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<tiles:insert page="/general/templateLoggedIn.jsp">
	<tiles:put name="title" value="User Administration"/>
	<tiles:put name="nav"/>
	<tiles:put name="content" type="string">
		<h2>User Administration</h2>
			
			<html:link href="userAdmin.do?method=create">Create a new user. <img src="<html:rewrite page="/res/img/new-user.png"/>"></html:link><br>
			<br>
					
		<c:choose>
			<c:when test="${request.usersEmpty != true}">
		<table>
			<tr><th>Mail</th><th>Role</th><th>Options</th></tr>	
				
				<c:forEach var="user" items="${request.users}">
				
				<tr>
					<td>${user.mail}</td>
					<td>${user.role}</td>
					<td>
						<html:link action="userProfile">
							<img src="<html:rewrite page="/res/img/user-profile.png"/>">
						</html:link>
						<html:link action="editUser">
							<img src="<html:rewrite page="/res/img/edit-user.png"/>">
						</html:link>
						<html:link action="deleteUser">
							<img src="<html:rewrite page="/res/img/delte-user.png"/>">
						</html:link>
					</td>
				</tr>
				
				</c:forEach>
		</table>
		</c:when>
		<c:otherwise>
			There are no users up to now.
		</c:otherwise>
		</c:choose>
		
		
		
<!-- 			There are no users at the moment. To create one, please click on the link above. -->
			
		
		
	</tiles:put>
</tiles:insert>